eventsource-client
Client for the Server-Sent Events protocol (aka EventSource).
Requirements
Requires tokio.
Usage
Example that just prints the type of each event received:
use eventsource_client as es;
let mut client = for_url?
.header?
.build;
client
.stream
.map_ok
.map_err;
(Some boilerplate omitted for clarity; see examples directory for complete, working code.)
Features
- tokio-based streaming client.
- Supports setting custom headers on the HTTP request (e.g. for endpoints requiring authorization).
- Retry for failed connections.
- Reconnection if connection is interrupted, with exponential backoff.
Stability
Early stage release for feedback purposes. May contain bugs or performance issues. API subject to change.